package cn.yu.takeoutbackend.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class statisticalTimeAdvice {

    @Around("execution(* cn.yu.takeoutbackend.scientificResearchManagementSystem.service.impl.ScientificResearchManagementSystemServiceImpl.getAll())")
    public Object method(ProceedingJoinPoint pjp) throws Throwable {
        final long start = System.nanoTime();

        final Object proceed = pjp.proceed();


        final long end = System.nanoTime();

        final long time = end - start;
        System.out.println("耗时：" + time);
        return proceed;
    }
}
